Outlinks

Hi all,

I have written one DXL script to perform the following actions,

1. List the requirements where Object type is a requirement and contains the outlinks in the current module.
2. List the requirements where Object type is a requirement and does not contain the outlinks in the current module.
3. List the requirements where Object type is a requirement and contains the outlinks in the current module.

Problem:

While listing the requirements where Object type is a requirement and contains the outlinks in the current module Iam geeting some duplicates requirements. In the attached document I made red colour for one pariticular requirement which is repeating. Like wise some other requirements are also there.

Pelase provide the solutioon ASAP.
Please find the below DXL script

// This DXL performs the following:
// 1. Total number of SRQ requirements
// 2. Total number of Outlinks present in the SRQ
// 3. Missing outlinks in the SRQ

Module m = current
Object o = null
Link lnk
Link lnk1

string oot = ""
string oid = ""

int lnk_count = 0
int lnk_count1 = 0
int Req_Count = 0
int lnk1_count = 0

for o in m do {

oot = o."rbe Object Type"
oid = o."Absolute Number"

// This logic is for the

if oot == "Requirement" then {

Req_Count ++

bool link_found = false

for lnk in o -> "*" do {

lnk_count++

link_found = true

// List the object ids which are requirements but no links are present

if link_found == false then {

lnk_count1++

print "Missing-Link-SRQ" oid "\n"

}

print "Correct-Link-SRQ" oid "\n"

} // Link do

lnk_count1 = Req_Count - lnk_count

} else {

bool link_found = false

for lnk1 in o -> "*" do {

lnk1_count++

link_found = true

print "Wrong-Link-SRQ" oid "\n" // List the object ids which contains the wrong links

}

} // end of else

} // object do

print "link count for Object contains requirement tag " lnk_count "\n"

print "Object contains requirement tag " Req_Count "\n"

print "Missing links for the requirements in SRQ " lnk_count1 "\n"

print "Wrong links for the requirements in SRQ " lnk1_count "\n"
GABE_surendra_Reddy - Fri Oct 07 02:14:54 EDT 2011

Re: Outlinks
GABE_surendra_Reddy - Fri Oct 07 02:55:49 EDT 2011

Found the solution.

Re: Outlinks
kltention - Thu Oct 19 16:22:14 EDT 2017

Hi! I am actually referencing your solutions for a project of my own. However I have a question about one of your for loops.  I hope you are able to help 6 years later.

 

if oot == "Requirement" then {

Req_Count ++

bool link_found = false

for lnk in o -> "*" do {

lnk_count++

link_found = true

// List the object ids which are requirements but no links are present

if link_found == false then { At this point in your code, link_found is true and is always true bc there is no condition to set it to false if no link is found. It is always link_found is always true in the  for loop

lnk_count1++

print "Missing-Link-SRQ" oid "\n"

}

 

The Problem occurring for me is that it is not printing the Missing Link SRQ

 

 

Re: Outlinks
Mike.Scharnow - Fri Oct 20 04:05:09 EDT 2017

kltention - Thu Oct 19 16:22:14 EDT 2017

Hi! I am actually referencing your solutions for a project of my own. However I have a question about one of your for loops.  I hope you are able to help 6 years later.

 

if oot == "Requirement" then {

Req_Count ++

bool link_found = false

for lnk in o -> "*" do {

lnk_count++

link_found = true

// List the object ids which are requirements but no links are present

if link_found == false then { At this point in your code, link_found is true and is always true bc there is no condition to set it to false if no link is found. It is always link_found is always true in the  for loop

lnk_count1++

print "Missing-Link-SRQ" oid "\n"

}

 

The Problem occurring for me is that it is not printing the Missing Link SRQ

 

 

not my code but the line 

} // Link do

obviously has to be moved upwards, above the line if link_found == false...

Re: Outlinks
kltention - Fri Oct 20 11:33:30 EDT 2017

Mike.Scharnow - Fri Oct 20 04:05:09 EDT 2017

not my code but the line 

} // Link do

obviously has to be moved upwards, above the line if link_found == false...

Indeed.I actually figured it out yesterday evening after I got an extra set of eyes to take a look. But thanks!